CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(script)

ADD_SUBDIRECTORY (glue)

INCLUDE(script.list)

FIND_PACKAGE(Boost REQUIRED)
FIND_PACKAGE(OGRE REQUIRED)
FIND_PACKAGE(OIS REQUIRED)
FIND_PACKAGE(Bullet REQUIRED)
#FIND_PACKAGE(MYGUI REQUIRED)
FIND_PACKAGE(CEGUI REQUIRED)
FIND_PACKAGE(LUA REQUIRED)
FIND_PACKAGE(V8 REQUIRED)
FIND_PACKAGE(SigC REQUIRED)
FIND_PACKAGE(OpenAL REQUIRED)

SET(CMAKE_INCLUDE_CURRENT_DIR ON)

SET(CMAKE_REQUIRED_LIBRARIES "MudBath;${CMAKE_REQUIRED_LIBRARIES}")

INCLUDE_DIRECTORIES(
	.
	./glue
	./glue/lua
	MudBath
	libs
	libs/BtOgre
	libs/tinyxml
	libs/my-gui/Common
	libs/angelscript
	#${MYGUI_INCLUDE_DIR}
	${CEGUI_INCLUDE_DIRS}
	${OPENAL_INCLUDE_DIR}	
	${Bullet_INCLUDE_DIRS}
	${LUA_INCLUDE_DIR}
	${V8_INCLUDE_DIR}
	${SIGC_INCLUDE_DIRS}
	${ANGLESCRIPT_INCLUDE_DIR}
	${OIS_INCLUDE_DIRS}
	${OGRE_INCLUDE_DIRS}
	${OGRE_SAMPLES_INCLUDEPATH}
)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fPIC")

link_directories ("/usr/local/lib")

#ADD_LIBRARY(script SHARED ${HEADERS} ${SOURCES})
ADD_LIBRARY(script STATIC ${HEADERS} ${SOURCES})
TARGET_LINK_LIBRARIES(script
	${LIBRARIES}
	${OGRE_LIBRARIES} 
	${OIS_LIBRARIES} 
	${LUA_LIBRARY} 
	${V8_LIBRARIES}
	${CEGUI_LIBRARY}
	#${MYGUI_LIBRARIES} 
	${BULLET_LIBRARIES} 
	${SIGC_LIBS} 
	${OPENAL_LIBRARY} 
	#-lMyGUI.OgrePlatform 
	-lCEGUIOgreRenderer
	-lCEGUIBase
	-lCEGUILuaScriptModule
	${CMAKE_REQUIRED_LIBRARIES}
)

